#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vll = vector<llt>;

template<typename T>
void input(vector<T> & a, int n){
    a.assign(n + 1, {});
    for(int i=1;i<=n;++i) cin >> a[i];
    return;
}

template<typename T>
istream & operator >> (istream & is, vector<T> & v){
    for(auto & i : v) is >> i;
    return is;
}

string S;

bool proc(){
    int cnt[256] = {0};
    for(auto c : S) cnt[c] += 1;
    map<int, vector<char>> mm;
    for(int i='a';i<='z';++i)if(cnt[i])mm[cnt[i]].push_back(i);
    for(const auto & p : mm){
        if(p.second.size() != 2) return false;
    }
    return true;
}

void work(){
    cin >> S;
    cout << (proc() ? "Yes\n" : "No\n");
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}